package com.fa4j.system.app.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fa4j.common.base.model.CommonState;
import com.fa4j.common.base.model.Tree;
import com.fa4j.common.data.model.Base;
import com.fa4j.common.data.repository.handler.StringListTypeHandler;
import com.fa4j.common.web.model.AppType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

/**
 * 系统应用菜单
 *
 * @since 2025-07-14 11:04:33
 */
@Data
@TableName(value = "t_sys_app_menu", autoResultMap = true)
@Schema(description = "系统应用菜单")
public class AppMenu extends Base implements Tree<Integer, AppMenu> {

    @Schema(description = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @Schema(description = "应用类型")
    private AppType appType;

    @Schema(description = "上级ID")
    private Integer parentId;

    @Schema(description = "资源名称")
    private String name;

    @Schema(description = "模块名称")
    private String moduleName;

    @Schema(description = "资源编码")
    private String code;

    @Schema(description = "状态")
    private CommonState state;

    @Schema(description = "资源类型")
    private AppMenuType type;

    @Schema(description = "优先级")
    private Integer priority;

    @Schema(description = "地址路径")
    private String path;

    @Schema(description = "图标")
    private String icon;

    @Schema(description = "是否显示")
    private Boolean visible;

    @Schema(description = "api集合")
    @TableField(typeHandler = StringListTypeHandler.class)
    private List<String> apis;

    @Schema(description = "操作人ID")
    private Long operatorId;

    @Schema(description = "下级菜单")
    @TableField(exist = false)
    private List<AppMenu> children;


}
